﻿#ifndef GATEWAY_H
#define GATEWAY_H

//#include "src/middle/structs/cloudmodels.h"
#include <QJsonValue>
#include <QObject>
#include "src/middle/config/apis.h"


/// @brief GUI 与 DAO 之间的网关
///
/// 它负责将来自 GUI 的请求转发到后端, 并通过 DAO 执行任务.
///
class GateWay : public QObject
{
    Q_OBJECT
public:
    explicit GateWay(QObject *parent = nullptr);
    ~GateWay();

    void send(int api, const QJsonValue& params=QJsonValue());

private:
    void dispach(int api, const QJsonValue& params);

    void apiLogin(const QJsonValue& params);
    void apiGetBuckets(const QJsonValue&);
    void apiPutBucket(const QJsonValue& params);
    void apiDeleteBucket(const QJsonValue& params);
    void apiGetObjects(const QJsonValue& params);
    void apiGetObject(const QJsonValue& params);
    void apiPutObject(const QJsonValue& params);
};

#endif // GATEWAY_H
